package com.workplan.client.widgets.pastemployees;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import com.workplan.client.widgets.employeeitem.EmployeeItem;
import com.workplan.client.widgets.employeeitem.EmployeeItemPresenter;
import com.workplan.client.widgets.employeeitem.EmployeeItemPresenterImpl;
import com.workplan.shared.datamodel.employee.EmployeeDataModel;
import com.workplan.shared.datamodel.employee.EmployeeDataModel.Role;

public class PastEmployeesPresenterImpl extends
		WidgetPresenter<PastEmployeesPresenter.Display> implements
		PastEmployeesPresenter {

	public PastEmployeesPresenterImpl(Display display, EventBus eventBus) {
		super(display, eventBus);
	}

	@Override
	protected void onBind() {
		// TODO bring data from a service

		// TODO remove this dummy data
		for (int i = 0; i < 8; i++) {
			EmployeeItemPresenter eip = createEmployeeItem(eventBus);
			display.addListItem(eip.getDisplay());
		}

	}

	// TODO remove this dummy data
	private EmployeeItemPresenter createEmployeeItem(EventBus eventBus) {
		EmployeeItemPresenter.Display employeeItem = new EmployeeItem();
		EmployeeItemPresenter employeeItemPresenter = new EmployeeItemPresenterImpl(
				employeeItem, eventBus);
		employeeItemPresenter.bind();
		EmployeeDataModel employeeDataModel = new EmployeeDataModel(1, "Nadav",
				"Greenberg", "0503335855", "grnadav@gmail.com", 2, 4,
				Role.SHIFT_MANAGER);
		employeeItemPresenter.setModel(employeeDataModel);
		return employeeItemPresenter;
	}

	@Override
	protected void onUnbind() {
		// TODO Auto-generated method stub

	}

	@Override
	protected void onRevealDisplay() {
	}

}
